home *** CD-ROM | disk | FTP | other *** search
- class classes.shots.DroidCMissle
- {
- var x;
- var y;
- var id;
- var dir;
- var clip;
- var axis;
- var speed;
- var ac;
- var ep;
- var xMov = 0;
- var yMov = 0;
- var xMovT = 0;
- var yMovT = 0;
- var Name = "droidCMissle";
- var power = 25;
- var yank = false;
- function DroidCMissle(px, py, pdir, pid)
- {
- this.x = px;
- this.y = py;
- this.id = pid;
- this.dir = pdir;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("droidCMissle","droidCMissle" + this.id + "Clip",_root.d);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.clip.id = this.id;
- this.xMov = 0;
- this.yMov = 0;
- if(this.dir == "U")
- {
- this.axis = "y";
- this.yMovT = -8;
- this.xMovT = 0;
- }
- else if(this.dir == "D")
- {
- this.axis = "y";
- this.yMovT = 8;
- this.xMovT = 0;
- }
- else if(this.dir == "R")
- {
- this.axis = "x";
- this.yMovT = 0;
- this.xMovT = 8;
- }
- else
- {
- this.axis = "x";
- this.yMovT = 0;
- this.xMovT = -8;
- }
- this.speed = 8;
- this.xMov *= _root.dif.speed;
- this.yMov *= _root.dif.speed;
- this.speed *= _root.dif.speed;
- this.clip.gotoAndStop("fly" + this.dir);
- this.xMovT *= _root.randRange2(0.9,1.1);
- this.yMovT *= _root.randRange2(0.9,1.1);
- this.ac = 0;
- this.ep = _root.randRange(10,30);
- }
- function hit()
- {
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(60,80),_root.randRange(85,100),"Purple"]);
- _root.audio.playLevel4("missleX" + (random(3) + 1),_root.randRange(25,30));
- var _loc3_ = 0;
- var _loc5_ = random(3);
- var _loc4_ = ["grey","red","grey2"];
- while(_loc3_ < _loc5_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_loc4_[random(2)]]);
- _loc3_ = _loc3_ + 1;
- }
- this.yank = true;
- }
- function bombed()
- {
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(60,80),_root.randRange(85,100),"Purple"]);
- _root.audio.playLevel4("missleX" + (random(3) + 1),_root.randRange(25,30));
- var _loc3_ = 0;
- var _loc5_ = random(3);
- var _loc4_ = ["grey","red","grey2"];
- while(_loc3_ < _loc5_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_loc4_[random(2)]]);
- _loc3_ = _loc3_ + 1;
- }
- this.yank = true;
- }
- function main()
- {
- this.ac = this.ac + 1;
- if(this.ac == this.ep)
- {
- var _loc8_ = _root.getAngleRad(this.x,this.y);
- this.xMovT = this.speed * Math.round(Math.cos(_loc8_));
- this.yMovT = this.speed * Math.round(Math.sin(_loc8_));
- if(this.xMovT < -1)
- {
- var _loc9_ = "L";
- }
- else if(this.xMovT > 1)
- {
- _loc9_ = "R";
- }
- else
- {
- _loc9_ = "";
- }
- if(this.yMovT < -1)
- {
- var _loc10_ = "U";
- }
- else if(this.yMovT > 1)
- {
- _loc10_ = "D";
- }
- else
- {
- _loc10_ = "";
- }
- this.clip.gotoAndStop("fly" + _loc9_ + _loc10_);
- this.ac = 0;
- this.ep = _root.randRange(10,30);
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(60,80),_root.randRange(85,100)]);
- _root.audio.playLevel4("missleX" + (random(3) + 1),_root.randRange(25,30));
- var _loc3_ = 0;
- var _loc6_ = random(3);
- var _loc5_ = ["grey","red","grey2"];
- while(_loc3_ < _loc6_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_loc5_[random(2)]]);
- _loc3_ = _loc3_ + 1;
- }
- this.yank = true;
- }
- _loc3_ = 0;
- _loc6_ = _root.broShots.length;
- while(_loc3_ < _loc6_)
- {
- var _loc7_ = _root.broShots[_loc3_] + "Clip";
- if(this.clip.hitTest(_root[_loc7_]))
- {
- _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
- var _loc4_ = _root.broShots[_loc3_];
- _root[_loc4_].exploX = this.x + this.clip._width / 2;
- _root[_loc4_].exploY = this.y + this.clip._height / 2;
- _root[_loc4_].hit(2);
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(60,80),_root.randRange(85,100)]);
- _root.audio.playLevel4("missleX" + (random(3) + 1),_root.randRange(25,30));
- _loc3_ = 0;
- _loc6_ = random(3);
- _loc5_ = ["grey","red","grey2"];
- while(_loc3_ < _loc6_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_loc5_[random(2)]]);
- _loc3_ = _loc3_ + 1;
- }
- this.yank = true;
- }
- _loc3_ = _loc3_ + 1;
- }
- if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
- {
- this.yank = true;
- }
- if(this.xMovT < this.xMov)
- {
- this.xMov -= 0.5;
- }
- else if(this.xMovT > this.xMov)
- {
- this.xMov += 0.5;
- }
- else
- {
- this.xMov = this.xMovT;
- }
- if(this.yMovT < this.yMov)
- {
- this.yMov -= 0.5;
- }
- else if(this.yMovT > this.yMov)
- {
- this.yMov += 0.5;
- }
- else
- {
- this.yMov = this.yMovT;
- }
- this.x += this.xMov;
- this.y += this.yMov;
- if(this.yank)
- {
- this.yank = false;
- _root.removeEnemyShot("droidCMissle" + this.id);
- }
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-